Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: ADR-038 go-plugin system #14207

Merged
merged 116 commits into from
Mar 14, 2023

Conversation

egaxhaj
Copy link
Contributor

@egaxhaj egaxhaj commented Dec 7, 2022

Description

For #10096

replaces #11691

implements #13473

This is an extension and refactor of the existing ADR-038 streaming service work to introduce a plugin system over gRPC to the SDK and load streaming services using the hashicorp/go-plugin system rather the approach taken in #11691 (which uses Go's built in Plugins API).

The plugin system introduced here is meant to be extensible, so that if other components/features of the SDK wish to be included as plugins in the future they can write plugins with minimal effort by defining an interface and a gRPC message protocol and leveraging the built in plugin system.

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@tac0turtle
Copy link
Member

@egaxhaj could you update to master and then we can merge this pr.

@tac0turtle
Copy link
Member

What is in the 22MB file store/streaming/abci/examples/file/file, should this be committed?

@egaxhaj would be good to get more information on this as well.

@kocubinski
Copy link
Member

Personally I don't think we should be adding so many replace directives to go.mod files if a go.work file would do that job. Does CI fail without the replace directive?

I also don't understand why we're committing 44 MB of opaque binary files.

@tac0turtle
Copy link
Member

tac0turtle commented Mar 14, 2023

Does CI fail without the replace directive?

Replace directives is something we do now or we run go get on the version in the pr. This removes the need for the replace tag. Then once tagged dependabot makes the change. We dont commit the go.work file, it is mainly meant for local development. this has caused some confusion

@egaxhaj
Copy link
Contributor Author

egaxhaj commented Mar 14, 2023

What is in the 22MB file store/streaming/abci/examples/file/file, should this be committed?

@egaxhaj would be good to get more information on this as well.

These are the go example plugin binaries (stdout, file). I can remove the file binary but the stdout binary is required to run the unit tests during CI as it is the default.

@tac0turtle
Copy link
Member

What is in the 22MB file store/streaming/abci/examples/file/file, should this be committed?

@egaxhaj would be good to get more information on this as well.

These are the go example plugin binaries (stdout, file). I can remove the file binary but the stdout binary is required to run the unit tests during CI as it is the default.

lets remove the file and the binary may be harder.

@kocubinski
Copy link
Member

kocubinski commented Mar 14, 2023

Replace directives is something we do now or we run go get on the version in the pr. This removes the need for the replace tag.

What is a "replace tag"?

We dont commit the go.work file, it is mainly meant for local development. this has caused some confusion

I know what we don't, and also understand the function of a go.work is for local development. That's why I asked if CI failed if the replace directives are removed. So, does it?

@tac0turtle
Copy link
Member

tac0turtle commented Mar 14, 2023

Replace directives is something we do now or we run go get on the version in the pr. This removes the need for the replace tag.

What is a "replace tag"?

https://go.dev/ref/mod#go-mod-file-replace same thing as replace directive

We dont commit the go.work file, it is mainly meant for local development. this has caused some confusion

I know what we don't, and also understand the function of a go.work is for local development. That's why I asked if CI failed if the replace directives are removed. So, does it?

On other prs it can, im not sure about this pr.

@egaxhaj
Copy link
Contributor Author

egaxhaj commented Mar 14, 2023

What is in the 22MB file store/streaming/abci/examples/file/file, should this be committed?

@egaxhaj would be good to get more information on this as well.

These are the go example plugin binaries (stdout, file). I can remove the file binary but the stdout binary is required to run the unit tests during CI as it is the default.

lets remove the file and the binary may be harder.

I've removed the file plugin binary and added a .gitignore and readme. Conflicts have been resolved as well.

@egaxhaj
Copy link
Contributor Author

egaxhaj commented Mar 14, 2023

@tac0turtle can we coordinate the merge for this PR? It's hard to keep up with other merges to main. I've had to update the branch 3 times in the last hour.

@egaxhaj
Copy link
Contributor Author

egaxhaj commented Mar 14, 2023

Replace directives is something we do now or we run go get on the version in the pr. This removes the need for the replace tag.

What is a "replace tag"?

https://go.dev/ref/mod#go-mod-file-replace same thing as replace directive

We dont commit the go.work file, it is mainly meant for local development. this has caused some confusion

I know what we don't, and also understand the function of a go.work is for local development. That's why I asked if CI failed if the replace directives are removed. So, does it?

On other prs it can, im not sure about this pr.

I am certain that some tests in CI will fail on this PR. Running make test locally fails with compilation errors if the replace tags are not in place because the other modules don't currently have the plugin code that resides in the store & baseapp package.

@tac0turtle tac0turtle enabled auto-merge (squash) March 14, 2023 17:57
@tac0turtle tac0turtle merged commit 6f3f2c9 into cosmos:main Mar 14, 2023
@julienrbrt
Copy link
Member

🚀
@egaxhaj do you wanna do the chore (removing the replaces and using a pseudo version from main) as a follow-up or should someone from our team do it?

@egaxhaj
Copy link
Contributor Author

egaxhaj commented Mar 14, 2023

Someone from the team please. I'm not familiar with the process the team follows.

for _, abciListener := range app.streamingManager.ABCIListeners {
ctx := app.deliverState.ctx
blockHeight := ctx.BlockHeight()
if err := abciListener.ListenBeginBlock(app.deliverState.ctx, req, res); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, doing the chore, and here, why app.deliverState.ctx is used and not ctx?

Copy link
Contributor Author

@egaxhaj egaxhaj Mar 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oversight. You can go ahead and use ctx.

@egaxhaj egaxhaj deleted the egaxhaj/adr-038-grpc2 branch March 14, 2023 22:22
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Co-authored-by: HuangYi <huang@crypto.com>
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Confix Issues and PR related to Confix C:Cosmovisor Issues and PR related to Cosmovisor C:Hubl Tool: Hubl C:Rosetta Issues and PR related to Rosetta C:Store C:x/circuit C:x/evidence C:x/feegrant C:x/nft C:x/upgrade Type: Build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants